from datetime import datetime
from RealProject.db_init import db



class Category(db.Model):
    """分类模型"""

    id = db.Column(db.Integer,primary_key = True)
    name = db.Column(db.String(128),nullable = False)
    icon = db.Column(db.String(128), nullable=True)
    add_date = db.Column(db.DateTime(128), nullable=False,default = datetime.utcnow)#创建时间
    pub_date = db.Column(db.DateTime(128),default = datetime.utcnow,onupdate = datetime.utcnow,nullable=False)#创建时间
    author = db.Column(db.String(128), nullable=True)
    def __repr__(self):
        return '<Category %r>'%self.name
